package com.ddstation.statement.mapper;

import java.util.Date;
import java.util.HashMap;
import java.util.List;

import com.ddstation.home_page.model.HpCommonParModel;
import com.ddstation.home_page.model.NameValueModel;
import com.ddstation.statement.model.TableStatisticItemModel;
import org.apache.ibatis.annotations.Param;

import com.ddstation.statement.model.IllegalInstitutionModel;

public interface StatisticsStatementMapper {
    // 查询卫监所管辖的镇·街道
    List<IllegalInstitutionModel> selectTownList(
            @Param("invsInstitutionId") String invsInstitutionId);

    int countUnderINVSHealthInstitutions(@Param("invsInstitutionId") String invsInstitutionId);

    int countDisinfectInstitutions(@Param("invsInstitutionId") String invsInstitutionId, @Param("startDt") Date startDt, @Param("endDt") Date endDt);

    int countEleMedicalHisHealthInstitutions(@Param("invsInstitutionId") String invsInstitutionId, @Param("startDt") Date startDt, @Param("endDt") Date endDt);

    int countMedicalHisByDuration(@Param("invsInstitutionId") String invsInstitutionId, @Param("startDt") Date startDt, @Param("endDt") Date endDt);

    int countPrescriptionByDuration(@Param("invsInstitutionId") String invsInstitutionId, @Param("startDt") Date startDt, @Param("endDt") Date endDt);

    int countMedicines(@Param("invsInstitutionId") String invsInstitutionId, @Param("startDt") Date startDt, @Param("endDt") Date endDt);

    int countErrorWithMSGId(@Param("invsInstitutionId") String invsInstitutionId, @Param("list") List<String> list, @Param("startDt") Date startDt, @Param("endDt") Date endDt);

    List<TableStatisticItemModel> countDisinfectDetail(@Param("invsInstitutionId") String invsInstitutionId, @Param("startDt") Date startDt, @Param("endDt") Date endDt);

    /**
     * 获取已监管、未监管机构数量
     * @param _p
     * @return
     */
    HashMap getInstitutionCountListByIsInvs(@Param("_p") HpCommonParModel _p);

    /**
     * 获取医疗机构资质已过期数量
     * @param _p
     * @return
     */
    Integer getOverdueInstitutionCount(@Param("_p") HpCommonParModel _p);

    /**
     * 获取监管执业医师数量
     * @param _p
     * @return
     */
    Integer getInvsDoctorsCount(@Param("_p") HpCommonParModel _p);

    /**
     * 获取执业医师分布 公立、民营数量
     * @param _p
     * @return
     */
    HashMap getDoctorsDistribution(@Param("_p") HpCommonParModel _p);

    /**
     * 获取监管机构分布数量 根据机构属性 公立、民营
     * @param _p
     * @return
     */
    HashMap getDistributionByInstitutionAttr(@Param("_p") HpCommonParModel _p);

    /**
     * 获取监管机构分布数量 根据机构类型一级目录
     * @param _p
     * @return
     */
    List<NameValueModel> getDistributionByInstitutionTypeFirst(@Param("_p") HpCommonParModel _p);

    /**
     * 获取 电子处方累计监管、违规数量
     * 获取 卫生台账累计监管、异常数量
     * @param _p
     * @return
     */
    HashMap getAccountAndPrescriptionStatistics(@Param("_p") HpCommonParModel _p);

    /**
     * 获取 机构处方、台账违规数量排行
     * @param _p
     * @return
     */
    List<HashMap> getInstitutionIllegalList(@Param("_p") HpCommonParModel _p, @Param("businessType")Integer businessType);

    /**
     * 获取 电子病历数量
     * @param _p
     * @return
     */
    Integer getMedicalHisCount(@Param("_p") HpCommonParModel _p);

    //电子处方数量查询
    public Integer statisticsDailyPrescription(@Param("_p")HpCommonParModel _p);
}
